//第二版
function objectFactory(){
    var obj=new Object();
    var Constructor=[].shift.call(arguments);
    obj.__proto__=Constructor.prototype;
    var ret=Constructor.apply(obj,arguments);
    return typeof ret==='object'?ret:obj;//如果返回的对象就返回函数返回的值，如果不是对象就返回本身obj
}

function Otaku (name, age) {
    this.strength = 60;
    this.age = age;

    return 'wangsan'
}
var person=objectFactory(Otaku,'zhansan',11);
console.log(person.name)
console.log(person.habit)
console.log(person.strength)
console.log(person.age)

